package com.llly.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.llly.mapper.OrderMapper;
import com.llly.pojo.Easybuy_order;
import com.llly.pojo.Easybuy_order_detail;
import com.llly.pojo.Easybuy_product;
import com.llly.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    //根据用户id查询订单
    @Override
    public Page<Easybuy_order> showOrder(Integer userId,Integer PageIndex) {
        Page<Easybuy_order> page= PageHelper.startPage(PageIndex==null?1:PageIndex,4);
        List<Easybuy_order> easybuy_orders = orderMapper.showOrder(userId);


        return page;
    }

    @Override
    public int delOrder(String serialNumber) {
        return orderMapper.delOrder(serialNumber);
    }

    @Override
    public int delAllOrder(String loginName) {
        return orderMapper.delAllOrder(loginName);
    }

    @Override
    public int addOrder(Easybuy_order easybuy_order) {
        return orderMapper.addOrder(easybuy_order);
    }

    @Override
    public int addOrderDetail(Easybuy_order_detail easybuy_order_detail) {
        return orderMapper.addOrderDetail(easybuy_order_detail);
    }


}
